using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using MalwareMultiScan.Backends.Extensions;
using MalwareMultiScan.Scanner.Services.Implementations;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace MalwareMultiScan.Scanner
{
    [ExcludeFromCodeCoverage]
    internal static class Program
    {
        public static async Task Main(string[] args)
        {
            await Host.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration(configure =>
                {
                    configure.AddJsonFile("appsettings.json");
                    configure.AddEnvironmentVariables();
                })
                .ConfigureServices((context, services) =>
                {
                    services.AddLogging();

                    services.AddRabbitMq(context.Configuration);
                    services.AddScanningBackend(context.Configuration);

                    services.AddHostedService<ScanHostedService>();
                }).RunConsoleAsync();
        }
    }
}